<template>
  <div class="accident-info-item">
    <div class="top">
      <div class="msg-item">
        <div class="index">{{ index + 1 }}</div>
        <div class="address">
          <div class="address-text">{{ sgdd }}</div>
          <div class="address-tags">
            <span class="tag tag1">一般警情</span>
            <span class="tag tag2" v-if="sglx">{{ sglx }}</span>
          </div>
        </div>
      </div>
    </div>

    <div class="bottom">
      <div class="desc">{{ jyaq }}</div>
      <div class="footer">
        <div class="date-time">{{ sgfssj }}</div>
        <div class="unit">{{ bmmc }}</div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { toRefs } from 'vue'
const props = defineProps(['index', 'sgdd', 'bmmc', 'sgfssj', 'jyaq', 'sglx'])
const { bmmc, sgfssj, jyaq } = toRefs(props)
</script>

<style lang="less" scoped>
.accident-info-item {
  border-bottom: 1px solid #8c8c8c;

  &:hover {
    background-color: rgba(0, 0, 0, 0.4);
  }
}

.top {
  .msg-item {
    display: flex;
    position: relative;
    // margin-bottom: 20px;
    padding: 10px;

    .index {
      position: absolute;
      left: 10px;
      top: 9px;
      width: 18px;
      font-size: 12px;
      padding: 2px 3px;
      text-align: center;
      border: 1px solid #fff;
      color: #fff;
      font-weight: 700;
      border-radius: 3px;
      transform: scale(0.7);
      transform-origin: left center;
    }

    .address {
      font-size: 12px;
      margin-left: 24px;
      color: #fff;
      flex: 1;

      .address-text {
        font-weight: 700;
        font-size: 14px;
      }

      .address-tags {
        margin-top: 2px;

        .tag {
          display: inline-block;
          padding: 1px 4px;
          border-radius: 2px;
          color: #fff;
          background-color: #09edf8 !important;
          transform: scale(0.88);
          transform-origin: left center;
        }

        .tag1 {}

        .tag2 {
          background-color: #0174f5 !important;
        }
      }
    }

    .follow {
      .follow-btn {
        border: 1px solid #fff;
        border-radius: 100px;
        font-size: 12px;
        width: 64px;
        display: flex;
        align-items: center;
        cursor: pointer;

        .follow-icon {
          width: 18px;
        }
      }
    }

    .state {
      position: absolute;
      top: 10px;
      right: 10px;
      padding: 5px;
      border: 1px solid rgba(23, 255, 243, 1);
      font-size: 12px;
    }
  }
}

.bottom {
  padding: 8px;
  font-size: 12px;
  color: #fff;

  .desc {
    height: 68px;
    // overflow: hidden;
    display: -webkit-box;
    /* 必须结合 -webkit-line-clamp 一起使用 */
    box-orient: vertical;
    /* 设置盒子方向为垂直 */
    overflow: hidden;
    /* 超出部分隐藏 */
    text-overflow: ellipsis;
    /* 显示省略号 */
    line-clamp: 3;
  }

  .footer {
    display: flex;
    font-weight: 700;
    justify-content: space-between;
    color: #797ca0;
    line-height: 32px;
  }
}
</style>
